from typing import Any


def get_and_check_module_and_qualname(obj: Any):
    module = obj.__module__
    if module == "__init__":
        raise ValueError(f'Object {obj!r} has an illegal module {module!r}!')

    qualname = obj.__qualname__
    if '<' in qualname or '>' in qualname:
        raise ValueError(f'Object {obj!r} has an illegal qualname {module!r}!')

    return module, qualname
